package org.icosagon.core;

import java.util.Date;

/**
 *
 * @author Daniel Owens
 */
public class MetaData {
    private String creator = null;
    private String name = null;
    private String version = null;
    private Date date = null;

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public String getCreator() {
        return creator;
    }

    public void setCreator(String creator) {
        this.creator = creator.trim();
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name.trim();
    }

    public String getVersion() {
        return version;
    }

    public void setVersion(String version) {
        this.version = version.trim();
    }

    @Override public int hashCode() {
        int code = 0;
        if(this.name != null)
            code += this.name.hashCode();
        if(this.version != null)
            code += this.version.hashCode();
        if(this.date != null)
            code += this.date.hashCode();

        return code;
    }

    @Override public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final MetaData other = (MetaData) obj;
        if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
            return false;
        }
        if ((this.version == null) ? (other.version != null) : !this.version.equals(other.version)) {
            return false;
        }
        if (this.date != other.date && (this.date == null || !this.date.equals(other.date))) {
            return false;
        }
        return true;
    }
}